<!--edit page create by pionner at Sun Nov 23 19:50:01 CST 2008-->
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@taglib uri="ttp://www.security.com/tag" prefix="sc"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
	<base href="<%=basePath%>">
		<title>TypeDefine</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link rel="stylesheet" href="css/style.css">
		<link rel="stylesheet" type="text/css" media="all" href="<%=path%>/js/calendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
	    <script type="text/javascript" src="<%=path%>/js/calendar/calendar.js"></script>
		<script type="text/javascript" src="<%=path%>/js/calendar/calendar-setup.js"></script>
		<script type="text/javascript" src="<%=path%>/js/calendar/calendar-zh1.js"></script>
		<script src='js/comm.js'></script>
	</head>
	<body>
		<table width="200" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="90"><img src="images/loc-head.jpg" width="90" height="24"></td>
				<td valign="middle" class="title" nowrap background="images/loc-bg.jpg">定时任务编辑-<s:property value="typeName"/> </td>
				<td width="12"><img src="images/loc-tail.jpg" width="12" height="24"></td>
			</tr>
		</table><br>

		<!--  <table>
			<tr>
				<td background="1images/tb-bg.jpg" width="120">&nbsp;
					<a href="javascript:document.all.addform.submit()" >
						 <sc:img processcode="button_subsearch" src="images/btn-submit.jpg" tip=""/>
						<!--  <img src="images/btn-submit.jpg" border="0" style="cursor:hand;">
					</a>
				</td>
				<td background="1images/tb-bg.jpg" width="120">&nbsp;
					<a href="<s:url action='typedefineDetail'><s:param name="id" value="id" /></s:url>" >
						<sc:img processcode="button_del" src="images/btn-del.jpg" tip=""/>
						<!--  <img src="images/btn-del.jpg" width="104" height="21" border="0" style="cursor:hand;">
					</a>
				</td>
				<td background="1images/tb-bg.jpg" width="120">&nbsp;
					<a href="<s:url action="typedefineList"><s:param name="id" value="id" /></s:url>" >
						<sc:img processcode="btn-list.jpg" src="images/btn-list.gif" tip=""/>
						<!--  <img src="images/btn-list.jpg" width="104" height="21" border="0" style="cursor:hand;">

					</a>
				</td>
			</tr>
		</table>

		<hr>-->
		<s:form name="addform"  action="typedefineSave.action">
			<table width='100%' border='0' cellspacing='1' class="ipttable">
				<s:hidden name='id' label='id'/>
				<s:textarea rows="4" cols="70" name='content'  label='内容'/>
				<s:textarea readonly="true" rows="3" cols="70" name='sqlstr' label='sql语句'/>
				<s:textfield name='contentFrom' label='发送部门' size="50"/>
				<s:textfield id="startDate" name='startDate' label='开始时间' size="50"/>
				<div>
					<s:textfield onclick="openunitwin()" id="loopType" name='loopType' label='循环间隔' size="50"/>
				</div>
				<!-- s:textfield name='loopType' label='循环间隔' size="50"/-->
				
				<s:textfield name='typeName' label='定时名称' size="50"/>
				<s:textfield readonly="true" name='dbType' label='数据源类型' size="50"/>
				<s:textfield readonly="true" name='dbLocation' label='数据库地址' size="50"/>
				
				<s:textfield readonly="true" name='dbDirver' label='数据库驱动' size="50" />
				<s:textfield readonly="true" name='dbUser' label='用户名' size="50"/>
				<s:textfield readonly="true" name='dbPassword' label='用户密码' size="50"/>
				<!--  s:textfield name='status' label='状态'/>-->
				<s:select name='status'  list="{'开启','关闭'}" value="status" label='状态'></s:select>
			</table>
			<table width='50%' border='0' cellspacing='0' >
			<tr>
			<td align="center">
			<input type="button" style="cursor: hand" value="提交" onClick="javascript:document.all.addform.submit()" class="btn">
			<input type="reset" style="cursor: hand" value="重置" class="btn">
			<input type="button" style="cursor: hand" value="返回" onClick="javascript:history.back(-1)" class="btn">
			</td>
			</tr>
			</table>
		</s:form>
	</body>
</html>
<script type="text/javascript">
<!--
	function openunitwin(){
		var title = ""; 
		var url = 'unitSel.jsp';
		var pageUrl="jsp/unitSel.jsp";
		var paraObj = new Object();
		paraObj.url=url;
		paraObj.title=title;
		var obj=document.getElementById('loopType');
		paraObj.input=obj;
		var sFeatures = 'help:no;status:1;dialogHeight:130px;dialogWidth:230px;center:1';
	    var rtnObj= window.showModalDialog(pageUrl,paraObj,sFeatures );
	    //alert('rtnObj='+rtnObj);
		if(rtnObj){
			var result=rtnObj.result;
			obj.value=result;
		}else{
    		
    	}
	}
	
	Calendar.setup(
		    {
		      inputField  : 'startDate',         // ID of the input field
		      ifFormat    : "%Y-%m-%d %H:%M:%S",    // the date format
		      onSelect   : onSelect,
		      showsTime : true
		    }
		  );
		 
function onSelect(calendar, date) {
    if (!IsDateBeforeToday(date)) {
    	var curEdt = document.getElementById(calendar.params.inputField.id);
      	curEdt.value = date;
      
    } else {
    	//alert();
    	window.status='所选日期不能小于今日!';
    }
	};

	 function IsDateBeforeToday(sDate) {
	   var ss = sDate.split('-'); 
	 var s = ss[1]+'-'+ss[2]+'-'+ss[0]; //形成月-日-年的格式,准备给Date.parse去解析
	 var d1 = new Date();
	 var d2 = Date.parse(s);
	 return d1 >= d2 ;
	 }
//-->
</script>
